# -*- coding: utf-8 -*-
from common import orm
from common.utils.types import Enum

BET_TYPE = Enum({
    'DIRECT_3': (301L, u'三星直选'),
    'SUM_3': (302L, u'三星直选和值'),

    'GROUP_3': (303L, u'三星组三'),
    'GROUP_6': (304L, u'三星组六'),
    'GROUP_3_SUM': (305L, u'三星组选和值'),

    'RANDOM': (306L, u'不定位'),
    'DWD': (307L, u'定位胆'),

    'DIRECT_2': (201L, u'二星直选'),
    'SUM_2': (202L, u'二星直选和值'),

    'GROUP_2': (203L, u'二星组选'),
    'GROUP_2_SUM': (204L, u'二星组选和值'),
    'BSOE': (205L, u'大小单双'),
})


class Order(orm.Model):
    __tablename__ = "fc3d_order"
    id = orm.Column(orm.BigInteger, primary_key=True)
    user_id = orm.Column(orm.BigInteger)
    track_id = orm.Column(orm.BigInteger)  # 每次追号会产生一个ID，普通的为null
    type = orm.Column(orm.SmallInteger)  # 订单类型
    term = orm.Column(orm.VARCHAR)  # 期号
    bet_type = orm.Column(orm.Integer)  # 押宝方式，见上面的枚举
    unit = orm.Column(orm.FLOAT, default=2)  # 用户自选的每注金额
    number = orm.Column(orm.VARCHAR)  # 用户购买数据，格式和bet_type有关
    price = orm.Column(orm.FLOAT)  # 总价
    status = orm.Column(orm.Integer)  # 订单状态
    track_status = orm.Column(orm.Integer)  # 追号状态
    times = orm.Column(orm.Integer, default=1)  # 倍数
    win_price = orm.Column(orm.FLOAT, default=0)  # 中奖金额
    bonus = orm.Column(orm.FLOAT, default=0)
    extend = orm.Column(orm.TEXT)
    created_at = orm.Column(orm.DATETIME)
    updated_at = orm.Column(orm.DATETIME)
